<?php
$this->breadcrumbs=array(
	'Danh sách tài liệu tham khảo',
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('document-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h3>Danh sách tài liệu tham khảo</h3>

<div class="listmenu clearfix img-rounded">
<?php 
	$this->widget('zii.widgets.CMenu',array(
	'items'=>array(	
		array('label'=>'<i class="icon-plus"></i> Tạo mới', 'url'=>array('create')),	
	),
	'encodeLabel'=>false,
	'htmlOptions'=>array(
	  'class'=>'menu-items'
	)
	));
?>
</div>
<i class="icon-search"></i>
<?php echo CHtml::link('Tìm kiếm','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'document-grid',
	'dataProvider'=>$model->search(),
  'pager'=>array
	(
    'maxButtonCount'=>10,
		'firstPageLabel' => '&lt;&lt;',
    'prevPageLabel'  => '&lt;',
    'nextPageLabel'  => '&gt;',
    'lastPageLabel'  => '&gt;&gt;',
		'header'=>'',
	),
	'columns'=>array(
		array(
      'name'=>'STT',
      'value'=>$this->stt_gridview,
    ),
		'name',
		array(
		  'name'=>'topicID',
		  'value'=>'Topic::model()->getName($data->topicID)',
		),
    array( 
			'name'=>'enabled',
      'value'=>'$data->getEnabled()',
    ),
		array(
      'name'=>'createddate',
      'value'=>'date("d-m-Y G:i:s",$data->createddate)',
    ),
    array(
      'name'=>'modifieddate',
      'value'=>'date("d-m-Y G:i:s",$data->modifieddate)',
    ),
		array(
			'class'=>'CButtonColumn',
		  'viewButtonImageUrl'=>'',
		  'viewButtonLabel'=>'',
		  'viewButtonOptions'=>array('class'=>'icon-list-alt','title'=>'Xem'),
		  'updateButtonImageUrl'=>'',
		  'updateButtonLabel'=>'',
		  'updateButtonOptions'=>array('class'=>'icon-edit','title'=>'Cập nhật'),
		  'deleteButtonImageUrl'=>'',
		  'deleteButtonLabel'=>'',
		  'deleteButtonOptions'=>array('class'=>'icon-remove','title'=>'Xóa'),
		),
	),
)); ?>
